﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Data.SqlClient;
using System.Data;

namespace OrmSmackdown
{
    [TestClass]
    public class Runner
    {
        IDbConnection db = new SqlConnection(SqlServerDSN);
        ILogger logger = new Logger();

        [TestMethod]
        public void ExerciseEntityFrameworks()
        {
            //Initial Version Done
            var entityFrameworks = new OrmSmackdown.EntityFrameworks.Exerciser("name=SqlSmackDownEntities");
            var exercises = new Exercises(entityFrameworks, logger);

            exercises.RunAll(db);
        }

        [TestMethod]
        public void ExerciseLinqToSql()
        {
            //Not Completed
            var linqToSql = new OrmSmackdown.LinqToSql.Exerciser();
            var exercises = new Exercises(linqToSql, logger);

            exercises.RunAll(db);
        }

        [TestMethod]
        public void ExerciseAdoDotNet()
        {
            //Not Completed
            var adoDotNet = new OrmSmackdown.AdoNet.Exerciser();
            var exercises = new Exercises(adoDotNet, logger);

            exercises.RunAll(db);
        }

        [TestMethod]
        public void ExerciseLinqToNHibernate()
        {
            //Initial Version Done
            var linq2nhibernate = new OrmSmackdown.LinqToNHibernate.Exerciser();
            var exercises = new Exercises(linq2nhibernate, logger);

            exercises.RunAll(db);
        }

        [TestMethod]
        public void ExerciseNHibernate()
        {
            //Initial Version Done
            var nhibernate = new OrmSmackdown.NHibernate.Exerciser();
            var exercises = new Exercises(nhibernate, logger);

            exercises.RunAll(db);
        }

        [TestMethod]
        public void ExerciseLightSpeedORM()
        {
            //Initial Version Done
            var lsORM = new OrmSmackdown.LightSpeedORM.Exerciser();
            var exercises = new Exercises(lsORM, logger);

            exercises.RunAll(db);
        }

        [TestMethod]
        public void ExerciseSubSonic()
        {
            //Not Completed
            var subsonic = new OrmSmackdown.SubSonic.Exerciser();
            var exercises = new Exercises(subsonic, logger);

            exercises.RunAll(db);
        }

        //[TestMethod]
        //public void ExerciseSubSonic3()
        //{
        //    //Not Completed
        //    var subsonic3 = new OrmSmackdown.SubSonic3.Exerciser();
        //    var exercises = new Exercises(subsonic3, logger);

        //    exercises.RunAll(db);
        //}

        [TestMethod]
        public void ExerciseLLBLGen()
        {
            //Initial Version Done
            var llblGen = new OrmSmackdown.LLBLGen.Exerciser();
            var exercises = new Exercises(llblGen, logger);

            exercises.RunAll(db);
        }


        //[TestMethod]
        //public void ExerciseMereMortals()
        //{
        //    //Not Completed
        //    var mereMortals = new OrmSmackdown.MereMortals.Exerciser();
        //    var exercises = new Exercises(mereMortals, logger);

        //    exercises.RunAll(db);
        //}


        private static string SqlServerDSN
        {
            get{return System.Configuration.ConfigurationManager.ConnectionStrings["ssdsn"].ConnectionString;}
        }


    }
}
